import request, { type ListResponse, type ListQuery } from "@/utils/request";
import { type PaymentType } from "./payment";

const BASE_URL = "/api/internal/PaymentRefund";

export const PaymentRefundAPI = {
  PaymentRefundList: (params: ListQuery) => {
    return request.get<any, ListResponse<PaymentRefundType>>(`${BASE_URL}/`, {
      params,
    });
  },
  PaymentRefundDetail: (id: number) => {
    return request.get<any, PaymentRefundType>(`${BASE_URL}/${id}/`);
  },
};

export type PaymentListQuery = {} & ListQuery;

export type PaymentRefundStatus = "pending" | "processing" | "success" | "fail";

export type PaymentRefundType = {
  id: string;
  payment: PaymentType;
  created_at: string;
  updated_at: string;
  is_active: boolean;
  refund_amount: string;
  out_refund_no: string;
  status: PaymentRefundStatus;
  success_time: string;
  reason: string;
};

export default PaymentRefundAPI;
